
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>10.2020-01-13-事务笔记 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="事务">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="2020-01-13-幂等性.html" />
    
    
    <link rel="prev" href="2020-01-12-缓存穿透-缓存击穿-缓存雪崩概念及解决方案.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    简介
            
                </a>
            

            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="2.1" >
            
                <span>
            
                    
                    [bigdata]
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1" data-path="../bigdata/2019-12-30-spark-in-docker.html">
            
                <a href="../bigdata/2019-12-30-spark-in-docker.html">
            
                    
                    1.2019-12-30-spark-in-docker
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2" data-path="../bigdata/2019-12-30-spark-RDD.html">
            
                <a href="../bigdata/2019-12-30-spark-RDD.html">
            
                    
                    2.2019-12-30-spark-RDD
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3" data-path="../bigdata/2019-12-31-hadoop-hdfs命令别名.html">
            
                <a href="../bigdata/2019-12-31-hadoop-hdfs命令别名.html">
            
                    
                    3.2019-12-31-hadoop-hdfs命令别名
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.2" >
            
                <span>
            
                    
                    [c]
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.2.1" data-path="../c/2020-01-07-c语言.html">
            
                <a href="../c/2020-01-07-c语言.html">
            
                    
                    1.2020-01-07-c语言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.2" data-path="../c/2020-01-07-C语言基础教程.html">
            
                <a href="../c/2020-01-07-C语言基础教程.html">
            
                    
                    2.2020-01-07-C语言基础教程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.3" data-path="../c/2020-01-09-c语言语法基础.html">
            
                <a href="../c/2020-01-09-c语言语法基础.html">
            
                    
                    3.2020-01-09-c语言语法基础
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.3" >
            
                <span>
            
                    
                    [DataStructureandAlgorithms]
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.3.1" data-path="../DataStructureandAlgorithms/2019-12-28-数据结构和算法的关系.html">
            
                <a href="../DataStructureandAlgorithms/2019-12-28-数据结构和算法的关系.html">
            
                    
                    1.2019-12-28-数据结构和算法的关系
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.2" data-path="../DataStructureandAlgorithms/2019-12-28-稀疏数组.html">
            
                <a href="../DataStructureandAlgorithms/2019-12-28-稀疏数组.html">
            
                    
                    2.2019-12-28-稀疏数组
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.4" >
            
                <span>
            
                    
                    [git]
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.4.1" data-path="../git/2019-12-28-git-alias.html">
            
                <a href="../git/2019-12-28-git-alias.html">
            
                    
                    1.2019-12-28-git-alias
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.2" data-path="../git/2019-12-29-git常用命令.html">
            
                <a href="../git/2019-12-29-git常用命令.html">
            
                    
                    2.2019-12-29-git常用命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.3" data-path="../git/2019-12-31-git教程.html">
            
                <a href="../git/2019-12-31-git教程.html">
            
                    
                    3.2019-12-31-git教程
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.5" >
            
                <span>
            
                    
                    [go]
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.5.1" data-path="../go/2019-12-30-beego基本使用.html">
            
                <a href="../go/2019-12-30-beego基本使用.html">
            
                    
                    1.2019-12-30-beego基本使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.6" >
            
                <span>
            
                    
                    [java]
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.6.1" data-path="2019-12-30-环境变量和系统属性.html">
            
                <a href="2019-12-30-环境变量和系统属性.html">
            
                    
                    1.2019-12-30-环境变量和系统属性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.2" data-path="2019-12-31-cloud-native-云原生.html">
            
                <a href="2019-12-31-cloud-native-云原生.html">
            
                    
                    2.2019-12-31-cloud-native-云原生
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.3" data-path="2019-12-31-java语法难点.html">
            
                <a href="2019-12-31-java语法难点.html">
            
                    
                    3.2019-12-31-java语法难点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.4" data-path="2019-12-31-设计模式.html">
            
                <a href="2019-12-31-设计模式.html">
            
                    
                    4.2019-12-31-设计模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.5" data-path="2020-01-12-Ajax跨域问题解决方案.html">
            
                <a href="2020-01-12-Ajax跨域问题解决方案.html">
            
                    
                    5.2020-01-12-Ajax跨域问题解决方案
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.6" data-path="2020-01-12-freemarker应用场景介绍.html">
            
                <a href="2020-01-12-freemarker应用场景介绍.html">
            
                    
                    6.2020-01-12-freemarker应用场景介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.7" data-path="2020-01-12-jsp运行原理和运行过程.html">
            
                <a href="2020-01-12-jsp运行原理和运行过程.html">
            
                    
                    7.2020-01-12-jsp运行原理和运行过程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.8" data-path="2020-01-12-深入理解Maven中的Profile.html">
            
                <a href="2020-01-12-深入理解Maven中的Profile.html">
            
                    
                    8.2020-01-12-深入理解Maven中的Profile
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.9" data-path="2020-01-12-缓存穿透-缓存击穿-缓存雪崩概念及解决方案.html">
            
                <a href="2020-01-12-缓存穿透-缓存击穿-缓存雪崩概念及解决方案.html">
            
                    
                    9.2020-01-12-缓存穿透-缓存击穿-缓存雪崩概念及解决方案
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="2.6.10" data-path="2020-01-13-事务笔记.html">
            
                <a href="2020-01-13-事务笔记.html">
            
                    
                    10.2020-01-13-事务笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.11" data-path="2020-01-13-幂等性.html">
            
                <a href="2020-01-13-幂等性.html">
            
                    
                    11.2020-01-13-幂等性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.12" data-path="2020-01-16-java基本语法.html">
            
                <a href="2020-01-16-java基本语法.html">
            
                    
                    12.2020-01-16-java基本语法
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.7" >
            
                <span>
            
                    
                    [arthas]
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.7.1" data-path="arthas/2019-12-28-arthas-example.html">
            
                <a href="arthas/2019-12-28-arthas-example.html">
            
                    
                    1.2019-12-28-arthas-example
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7.2" data-path="arthas/2019-12-28-arthas添加支持执行历史命令的shell功能.html">
            
                <a href="arthas/2019-12-28-arthas添加支持执行历史命令的shell功能.html">
            
                    
                    2.2019-12-28-arthas添加支持执行历史命令的shell功能
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7.3" data-path="arthas/2020-01-10-思考性能调优.html">
            
                <a href="arthas/2020-01-10-思考性能调优.html">
            
                    
                    3.2020-01-10-思考性能调优
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7.4" data-path="arthas/2020-01-10-性能调优举例-最佳实践.html">
            
                <a href="arthas/2020-01-10-性能调优举例-最佳实践.html">
            
                    
                    4.2020-01-10-性能调优举例-最佳实践
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7.5" data-path="arthas/2020-01-10-性能调优举例一.html">
            
                <a href="arthas/2020-01-10-性能调优举例一.html">
            
                    
                    5.2020-01-10-性能调优举例一
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7.6" data-path="arthas/2020-01-10-性能调优举例三.html">
            
                <a href="arthas/2020-01-10-性能调优举例三.html">
            
                    
                    6.2020-01-10-性能调优举例三
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7.7" data-path="arthas/2020-01-10-性能调优举例二.html">
            
                <a href="arthas/2020-01-10-性能调优举例二.html">
            
                    
                    7.2020-01-10-性能调优举例二
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7.8" data-path="arthas/2020-01-10-性能调优举例四.html">
            
                <a href="arthas/2020-01-10-性能调优举例四.html">
            
                    
                    8.2020-01-10-性能调优举例四
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7.9" data-path="arthas/2020-01-15-性能调优举例五.html">
            
                <a href="arthas/2020-01-15-性能调优举例五.html">
            
                    
                    9.2020-01-15-性能调优举例五
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7.10" data-path="arthas/2020-05-12-性能调优举例六.html">
            
                <a href="arthas/2020-05-12-性能调优举例六.html">
            
                    
                    10.2020-05-12-性能调优举例六
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7.11" data-path="arthas/arthas-mind-map.html">
            
                <a href="arthas/arthas-mind-map.html">
            
                    
                    11.arthas-mind-map
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.8" >
            
                <span>
            
                    
                    [dubbo]
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.8.1" data-path="dubbo/2019-12-28-dubbo涉及的技术.html">
            
                <a href="dubbo/2019-12-28-dubbo涉及的技术.html">
            
                    
                    1.2019-12-28-dubbo涉及的技术
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.8.2" data-path="dubbo/2019-12-30-dubbo消费者访问流程.html">
            
                <a href="dubbo/2019-12-30-dubbo消费者访问流程.html">
            
                    
                    2.2019-12-30-dubbo消费者访问流程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.8.3" data-path="dubbo/2019-12-30-dubbo面试.html">
            
                <a href="dubbo/2019-12-30-dubbo面试.html">
            
                    
                    3.2019-12-30-dubbo面试
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.9" >
            
                <span>
            
                    
                    [jdk]
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.9.1" data-path="jdk/2020-01-12-实例介绍 JAVA 泛型基础.html">
            
                <a href="jdk/2020-01-12-实例介绍 JAVA 泛型基础.html">
            
                    
                    1.2020-01-12-实例介绍 JAVA 泛型基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.9.2" data-path="jdk/2020-01-13-ThreadLocal六连问.html">
            
                <a href="jdk/2020-01-13-ThreadLocal六连问.html">
            
                    
                    2.2020-01-13-ThreadLocal六连问
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.10" >
            
                <span>
            
                    
                    [jvm]
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.10.1" data-path="jvm/2019-12-30-性能调优.html">
            
                <a href="jvm/2019-12-30-性能调优.html">
            
                    
                    1.2019-12-30-性能调优
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.11" >
            
                <span>
            
                    
                    [netty]
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.11.1" data-path="netty/2020-01-16-netty入门.html">
            
                <a href="netty/2020-01-16-netty入门.html">
            
                    
                    1.2020-01-16-netty入门
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.11.2" data-path="netty/2020-01-16-netty核心概念.html">
            
                <a href="netty/2020-01-16-netty核心概念.html">
            
                    
                    2.2020-01-16-netty核心概念
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.12" >
            
                <span>
            
                    
                    [solr]
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.12.1" data-path="solr/2019-12-28-solr-7.6.0.tgz安装.html">
            
                <a href="solr/2019-12-28-solr-7.6.0.tgz安装.html">
            
                    
                    1.2019-12-28-solr-7.6.0.tgz安装
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.13" >
            
                <span>
            
                    
                    [spring]
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.13.1" data-path="spring/2020-01-12-SpringBoot属性读取方式介绍.html">
            
                <a href="spring/2020-01-12-SpringBoot属性读取方式介绍.html">
            
                    
                    1.2020-01-12-SpringBoot属性读取方式介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13.2" data-path="spring/2020-01-12-使用spring boot+mybatis plus快速入门.html">
            
                <a href="spring/2020-01-12-使用spring boot+mybatis plus快速入门.html">
            
                    
                    2.2020-01-12-使用spring boot+mybatis plus快速入门
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13.3" data-path="spring/2020-01-13-spring-initMethod-destoryMethod.html">
            
                <a href="spring/2020-01-13-spring-initMethod-destoryMethod.html">
            
                    
                    3.2020-01-13-spring-initMethod-destoryMethod
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13.4" data-path="spring/2020-01-13-spring循环依赖.html">
            
                <a href="spring/2020-01-13-spring循环依赖.html">
            
                    
                    4.2020-01-13-spring循环依赖
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13.5" data-path="spring/2020-01-13-spring源码随记.html">
            
                <a href="spring/2020-01-13-spring源码随记.html">
            
                    
                    5.2020-01-13-spring源码随记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13.6" data-path="spring/2020-01-13-自定义mini-spring.html">
            
                <a href="spring/2020-01-13-自定义mini-spring.html">
            
                    
                    6.2020-01-13-自定义mini-spring
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.14" >
            
                <span>
            
                    
                    [websocket]
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.14.1" data-path="websocket/2019-12-30-webscoket-springboot通信.html">
            
                <a href="websocket/2019-12-30-webscoket-springboot通信.html">
            
                    
                    1.2019-12-30-webscoket-springboot通信
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.15" >
            
                <span>
            
                    
                    [linux]
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.15.1" data-path="../linux/2019-12-28-Linux常用命令和快捷键.html">
            
                <a href="../linux/2019-12-28-Linux常用命令和快捷键.html">
            
                    
                    1.2019-12-28-Linux常用命令和快捷键
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.15.2" data-path="../linux/2019-12-28-从零到一环境安装.html">
            
                <a href="../linux/2019-12-28-从零到一环境安装.html">
            
                    
                    2.2019-12-28-从零到一环境安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.15.3" data-path="../linux/2019-12-30-vi-常用命令.html">
            
                <a href="../linux/2019-12-30-vi-常用命令.html">
            
                    
                    3.2019-12-30-vi-常用命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.15.4" data-path="../linux/2019-12-31-awk命令.html">
            
                <a href="../linux/2019-12-31-awk命令.html">
            
                    
                    4.2019-12-31-awk命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.15.5" data-path="../linux/2019-12-31-cup信息分析.html">
            
                <a href="../linux/2019-12-31-cup信息分析.html">
            
                    
                    5.2019-12-31-cup信息分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.15.6" data-path="../linux/2019-12-31-shell编程.html">
            
                <a href="../linux/2019-12-31-shell编程.html">
            
                    
                    6.2019-12-31-shell编程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.15.7" data-path="../linux/2019-12-31-top命令.html">
            
                <a href="../linux/2019-12-31-top命令.html">
            
                    
                    7.2019-12-31-top命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.15.8" data-path="../linux/2019-12-31-普通用户docker的问题.html">
            
                <a href="../linux/2019-12-31-普通用户docker的问题.html">
            
                    
                    8.2019-12-31-普通用户docker的问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.15.9" data-path="../linux/2020-01-01-centos7 安装kubernetes.html">
            
                <a href="../linux/2020-01-01-centos7 安装kubernetes.html">
            
                    
                    9.2020-01-01-centos7 安装kubernetes
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.15.10" data-path="../linux/2020-01-01-centos安装常用配置.html">
            
                <a href="../linux/2020-01-01-centos安装常用配置.html">
            
                    
                    10.2020-01-01-centos安装常用配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.15.11" data-path="../linux/2020-01-01-docker使用.html">
            
                <a href="../linux/2020-01-01-docker使用.html">
            
                    
                    11.2020-01-01-docker使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.15.12" data-path="../linux/2020-01-01-kubernetes使用.html">
            
                <a href="../linux/2020-01-01-kubernetes使用.html">
            
                    
                    12.2020-01-01-kubernetes使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.15.13" data-path="../linux/2020-05-12-PG有用的SQL.html">
            
                <a href="../linux/2020-05-12-PG有用的SQL.html">
            
                    
                    13.2020-05-12-PG有用的SQL
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.15.14" data-path="../linux/2020-05-12-vim命令.html">
            
                <a href="../linux/2020-05-12-vim命令.html">
            
                    
                    14.2020-05-12-vim命令
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.16" >
            
                <span>
            
                    
                    [automate]
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.16.1" data-path="../linux/automate/2020-01-12-redis伪集群创建脚本.html">
            
                <a href="../linux/automate/2020-01-12-redis伪集群创建脚本.html">
            
                    
                    1.2020-01-12-redis伪集群创建脚本
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.16.2" data-path="../linux/automate/2020-01-12-tomcat集群创建脚本.html">
            
                <a href="../linux/automate/2020-01-12-tomcat集群创建脚本.html">
            
                    
                    2.2020-01-12-tomcat集群创建脚本
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.16.3" data-path="../linux/automate/2020-01-12-zookeeper自动化脚本.html">
            
                <a href="../linux/automate/2020-01-12-zookeeper自动化脚本.html">
            
                    
                    3.2020-01-12-zookeeper自动化脚本
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.16.4" data-path="../linux/automate/2020-01-12-其他自动化脚本.html">
            
                <a href="../linux/automate/2020-01-12-其他自动化脚本.html">
            
                    
                    4.2020-01-12-其他自动化脚本
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.17" >
            
                <span>
            
                    
                    [MySQL]
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.17.1" data-path="../MySQL/2019-12-31-mysql常用命令.html">
            
                <a href="../MySQL/2019-12-31-mysql常用命令.html">
            
                    
                    1.2019-12-31-mysql常用命令
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.18" >
            
                <span>
            
                    
                    [nginx]
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.18.1" data-path="../nginx/2019-12-29-Nginx-Keepalived高可用集群.html">
            
                <a href="../nginx/2019-12-29-Nginx-Keepalived高可用集群.html">
            
                    
                    1.2019-12-29-Nginx-Keepalived高可用集群
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.18.2" data-path="../nginx/2020-01-16-nginx参数详细说明.html">
            
                <a href="../nginx/2020-01-16-nginx参数详细说明.html">
            
                    
                    2.2020-01-16-nginx参数详细说明
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.19" >
            
                <span>
            
                    
                    [other]
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.19.1" data-path="../other/2019-12-28-知识小计.html">
            
                <a href="../other/2019-12-28-知识小计.html">
            
                    
                    1.2019-12-28-知识小计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.19.2" data-path="../other/2020-01-04-科学上网.html">
            
                <a href="../other/2020-01-04-科学上网.html">
            
                    
                    2.2020-01-04-科学上网
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.19.3" data-path="../other/2020-05-13-正则表达式.html">
            
                <a href="../other/2020-05-13-正则表达式.html">
            
                    
                    3.2020-05-13-正则表达式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.19.4" data-path="../other/template.html">
            
                <a href="../other/template.html">
            
                    
                    4.template
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.20" >
            
                <span>
            
                    
                    [PostgreSQL]
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.20.1" data-path="../PostgreSQL/2019-12-28-PostgreSQL安装文档.html">
            
                <a href="../PostgreSQL/2019-12-28-PostgreSQL安装文档.html">
            
                    
                    1.2019-12-28-PostgreSQL安装文档
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.20.2" data-path="../PostgreSQL/2019-12-28-Postgres学习笔记.html">
            
                <a href="../PostgreSQL/2019-12-28-Postgres学习笔记.html">
            
                    
                    2.2019-12-28-Postgres学习笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.20.3" data-path="../PostgreSQL/2019-12-28-脚本MYSQL导出数据到PG.html">
            
                <a href="../PostgreSQL/2019-12-28-脚本MYSQL导出数据到PG.html">
            
                    
                    3.2019-12-28-脚本MYSQL导出数据到PG
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.20.4" data-path="../PostgreSQL/2020-01-04-docker-PostgreSQL安装文档.html">
            
                <a href="../PostgreSQL/2020-01-04-docker-PostgreSQL安装文档.html">
            
                    
                    4.2020-01-04-docker-PostgreSQL安装文档
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.20.5" data-path="../PostgreSQL/2020-01-17-阿里云PG主从切换问题.html">
            
                <a href="../PostgreSQL/2020-01-17-阿里云PG主从切换问题.html">
            
                    
                    5.2020-01-17-阿里云PG主从切换问题
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.21" >
            
                <span>
            
                    
                    [python]
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.21.1" data-path="../python/2019-12-28-pip-install指定国内源镜像.html">
            
                <a href="../python/2019-12-28-pip-install指定国内源镜像.html">
            
                    
                    1.2019-12-28-pip-install指定国内源镜像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.21.2" data-path="../python/2019-12-30-python内置函数.html">
            
                <a href="../python/2019-12-30-python内置函数.html">
            
                    
                    2.2019-12-30-python内置函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.21.3" data-path="../python/2019-12-30-一图搞懂基本python语法 .html">
            
                <a href="../python/2019-12-30-一图搞懂基本python语法 .html">
            
                    
                    3.2019-12-30-一图搞懂基本python语法 
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.22" >
            
                <span>
            
                    
                    [redis]
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.22.1" data-path="../redis/2019-12-28-redis5.0.3安装.html">
            
                <a href="../redis/2019-12-28-redis5.0.3安装.html">
            
                    
                    1.2019-12-28-redis5.0.3安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.22.2" data-path="../redis/2019-12-28-redis5.0.3集群搭建.html">
            
                <a href="../redis/2019-12-28-redis5.0.3集群搭建.html">
            
                    
                    2.2019-12-28-redis5.0.3集群搭建
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.23" >
            
                <span>
            
                    
                    [tool]
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.23.1" data-path="../tool/2019-12-28-idea高效使用技巧和快捷键.html">
            
                <a href="../tool/2019-12-28-idea高效使用技巧和快捷键.html">
            
                    
                    1.2019-12-28-idea高效使用技巧和快捷键
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.23.2" data-path="../tool/2019-12-28-PlantUML画图脚本.html">
            
                <a href="../tool/2019-12-28-PlantUML画图脚本.html">
            
                    
                    2.2019-12-28-PlantUML画图脚本
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.23.3" data-path="../tool/2019-12-30-vscode高效使用.html">
            
                <a href="../tool/2019-12-30-vscode高效使用.html">
            
                    
                    3.2019-12-30-vscode高效使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.24" >
            
                <span>
            
                    
                    [windows]
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.24.1" data-path="../windows/2020-01-12-本地服务成为互联网服务.html">
            
                <a href="../windows/2020-01-12-本地服务成为互联网服务.html">
            
                    
                    1.2020-01-12-本地服务成为互联网服务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.24.2" data-path="../windows/2020-01-12-注册bat为windows服务.html">
            
                <a href="../windows/2020-01-12-注册bat为windows服务.html">
            
                    
                    2.2020-01-12-注册bat为windows服务
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >10.2020-01-13-事务笔记</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <p>&#x57FA;&#x672C;&#x4E8B;&#x52A1;&#x77E5;&#x8BC6;</p>
<h2 id="&#x4E8B;&#x52A1;">&#x4E8B;&#x52A1;</h2>
<p>&#x4E8B;&#x52A1;&#xFF08;Transaction&#xFF09;&#xFF0C;&#x4E00;&#x822C;&#x662F;&#x6307;&#x8981;&#x505A;&#x7684;&#x6216;&#x6240;&#x505A;&#x7684;&#x4E8B;&#x60C5;&#x3002;&#x5728;&#x8BA1;&#x7B97;&#x673A;&#x672F;&#x8BED;&#x4E2D;&#x662F;&#x6307;&#x8BBF;&#x95EE;&#x5E76;&#x53EF;&#x80FD;&#x66F4;&#x65B0;&#x6570;&#x636E;&#x5E93;&#x4E2D;&#x5404;&#x79CD;&#x6570;&#x636E;&#x9879;&#x7684;&#x4E00;&#x4E2A;&#x7A0B;&#x5E8F;&#x6267;&#x884C;&#x5355;&#x5143;(unit)&#x3002;&#x4E8B;&#x52A1;&#x901A;&#x5E38;&#x7531;&#x9AD8;&#x7EA7;&#x6570;&#x636E;&#x5E93;&#x64CD;&#x7EB5;&#x8BED;&#x8A00;&#x6216;&#x7F16;&#x7A0B;&#x8BED;&#x8A00;&#xFF08;&#x5982;SQL&#xFF0C;C++&#x6216;Java&#xFF09;&#x4E66;&#x5199;&#x7684;&#x7528;&#x6237;&#x7A0B;&#x5E8F;&#x7684;&#x6267;&#x884C;&#x6240;&#x5F15;&#x8D77;&#xFF0C;&#x5E76;&#x7528;&#x5F62;&#x5982;begin transaction&#x548C;end transaction&#x8BED;&#x53E5;&#xFF08;&#x6216;&#x51FD;&#x6570;&#x8C03;&#x7528;&#xFF09;&#x6765;&#x754C;&#x5B9A;&#x3002;&#x4E8B;&#x52A1;&#x7531;&#x4E8B;&#x52A1;&#x5F00;&#x59CB;(begin transaction)&#x548C;&#x4E8B;&#x52A1;&#x7ED3;&#x675F;(end transaction)&#x4E4B;&#x95F4;&#x6267;&#x884C;&#x7684;&#x5168;&#x4F53;&#x64CD;&#x4F5C;&#x7EC4;&#x6210;&#x3002;</p>
<h2 id="&#x4E00;&#x4E8B;&#x52A1;&#x7B80;&#x4ECB;">&#x4E00;:&#x4E8B;&#x52A1;&#x7B80;&#x4ECB;</h2>
<p>&#x6838;&#x5FC3;: &#x9501;  &#x5E76;&#x53D1;
&#x4F18;&#x52BF;:&#x5BB9;&#x6613;&#x7406;&#x89E3;
&#x52A3;&#x52BF;:&#x6027;&#x80FD;&#x8F83;&#x4F4E;</p>
<p>&#x5BB9;&#x6613;&#x7406;&#x89E3;&#x7684;&#x6A21;&#x578B;&#x6027;&#x80FD;&#x90FD;&#x4E0D;&#x597D;,
&#x6027;&#x80FD;&#x597D;&#x7684;&#x6A21;&#x5F0F;&#x90FD;&#x4E0D;&#x5BB9;&#x6613;&#x7406;&#x89E3;
&#x8FD9;&#x5C31;&#x662F;&#x751F;&#x6D3B;</p>
<p>DRDS&#x5DF2;&#x7ECF;&#x6B63;&#x5F0F;&#x767B;&#x9646;&#x963F;&#x91CC;&#x4E91;</p>
<h2 id="&#x4E8B;&#x52A1;&#x5355;&#x5143;">&#x4E8B;&#x52A1;&#x5355;&#x5143;</h2>
<p>&#x4E00;&#x4E2A;&#x4E8B;&#x52A1;&#x5355;&#x5143;: bob&#x7ED9;smith 100&#x5757;
&#x52A0;&#x9501;&#x8BA9;&#x4E8B;&#x52A1;&#x8BFB;&#x5199;&#x64CD;&#x4F5C;&#x987A;&#x5E8F;&#x6267;&#x884C;,&#x4FDD;&#x8BC1;&#x6570;&#x636E;&#x4E00;&#x81F4;&#x6027;</p>
<p>ACID&#x4FDD;&#x8BC1;&#x4E8B;&#x52A1;&#x5B8C;&#x6574;&#x6027; : A&#x539F;&#x5B50;&#x6027;,C&#x4E00;&#x81F4;&#x6027;,I &#x9694;&#x79BB;&#x6027;,D&#x6301;&#x4E45;&#x6027;</p>
<p>&#x4EE5;&#x4E0B;&#x90FD;&#x662F;&#x4E8B;&#x52A1;
&#x5EFA;&#x7ACB;&#x7D22;&#x5F15;
&#x8BFB;&#x53D6;&#x4E00;&#x884C;&#x8BB0;&#x5F55;
&#x5199;&#x5165;&#x4E00;&#x884C;&#x8BB0;&#x5F55;,&#x540C;&#x4E8B;&#x66F4;&#x65B0;&#x8BB0;&#x5F55;&#x7684;&#x6240;&#x6709;&#x6240;&#x6709;
&#x5220;&#x9664;&#x6574;&#x5F20;&#x8868;
&#x6240;&#x6709;&#x5BF9;&#x6570;&#x636E;&#x7684;&#x6BCF;&#x4E2A;&#x64CD;&#x4F5C;
Etc...</p>
<p>&#x4E00;&#x7EC4;&#x4E8B;&#x52A1;&#x5355;&#x5143;: 
bob&#x7ED9;smith 100&#x5757;,
smith&#x7ED9;joe 100&#x5757;,
smith&#x7ED9;bob 100&#x5757;</p>
<p>&#x4E8B;&#x52A1;&#x5355;&#x5143;&#x4E4B;&#x95F4;&#x7684;happen-before&#x5173;&#x7CFB;
&#x8BFB;&#x5199; &#x5199;&#x8BFB; &#x8BFB;&#x8BFB; &#x5199;&#x5199;
&#x4EFB;&#x4F55;&#x4E8B;&#x52A1;&#x5355;&#x5143;&#x4E4B;&#x95F4;&#x90FD;&#x662F;&#x4E0A;&#x9762;&#x56DB;&#x79CD;&#x5173;&#x7CFB;
&#x4E66;&#x7C4D; &lt;&lt;&#x4E8B;&#x52A1;&#x5904;&#x7406;&gt;&gt;</p>
<p>&#x95EE;&#x9898; &#x5982;&#x4F55;&#x80FD;&#x591F;&#x4EE5;&#x6700;&#x5757;&#x7684;&#x901F;&#x5EA6;&#x5B8C;&#x6210;?
&#x53C8;&#x80FD;&#x4FDD;&#x8BC1;&#x4E0A;&#x9762;&#x7684;&#x56DB;&#x79CD;&#x64CD;&#x4F5C;&#x7684;&#x903B;&#x8F91;&#x987A;&#x5E8F;</p>
<h2 id="&#x4E8C;&#x5904;&#x7406;&#x4E8B;&#x52A1;&#x7684;&#x5E38;&#x89C1;&#x601D;&#x8DEF;">&#x4E8C;:&#x5904;&#x7406;&#x4E8B;&#x52A1;&#x7684;&#x5E38;&#x89C1;&#x601D;&#x8DEF;</h2>
<p>&#x4E8B;&#x52A1;-&#x6392;&#x961F;&#x6CD5;
&#x5E8F;&#x5217;&#x5316;&#x8BFB;&#x5199;  &#x591A;&#x4E2A;&#x4E8B;&#x52A1;&#x5355;&#x5143;&#x987A;&#x5E8F;&#x6267;&#x884C;&#x8BFB;&#x5199;
&#x4F18;&#x52BF;---&#x4E0D;&#x9700;&#x8981;&#x51B2;&#x7A81;&#x63A7;&#x5236;
&#x52A3;&#x52BF;---&#x6162;&#x901F;&#x8BBE;&#x5907;...</p>
<p>&#x4E8B;&#x52A1;-&#x6392;&#x4ED6;&#x9501; 
&#x9488;&#x5BF9;&#x540C;&#x4E00;&#x4E2A;&#x4E8B;&#x52A1;&#x5355;&#x5143;&#x7684;&#x8BBF;&#x95EE;&#x8FDB;&#x884C;&#x63A7;&#x5236;
&#x6CA1;&#x6709;&#x5171;&#x4EAB;&#x6570;&#x636E;&#x7684;&#x4E8B;&#x52A1;&#x5355;&#x5143;&#x5C31;&#x662F;&#x72EC;&#x7ACB;&#x7684;&#x4E8B;&#x52A1;&#x5355;&#x5143;,&#x53EF;&#x4EE5;&#x548C;&#x5176;&#x5B83;&#x72EC;&#x7ACB;&#x5355;&#x5143;&#x52A0;&#x9501;&#x5E76;&#x884C;</p>
<p>&#x4E8B;&#x52A1;-&#x8BFB;&#x5199;&#x9501;
&#x8BFB;&#x8BFB; &#x5E76;&#x884C;  &#x5176;&#x5B83;&#x4E09;&#x79CD;&#x987A;&#x5E8F;</p>
<p>&#x4E8B;&#x52A1;-MVCC &#x4E3B;&#x6D41; &#x591A;&#x7248;&#x672C;&#x4E8B;&#x52A1;&#x63A7;&#x5236;
&#x672C;&#x8D28;&#x5C31;&#x662F;copy on write
&#x80FD;&#x591F;&#x505A;&#x5230;&#x5199;&#x4E0D;&#x963B;&#x585E;&#x8BFB;</p>
<p>&#x6765;&#x81EA;&#x767E;&#x5EA6;&#x767E;&#x79D1;
ACID&#xFF0C;&#x6307;&#x6570;&#x636E;&#x5E93;&#x4E8B;&#x52A1;&#x6B63;&#x786E;&#x6267;&#x884C;&#x7684;&#x56DB;&#x4E2A;&#x57FA;&#x672C;&#x8981;&#x7D20;&#x7684;&#x7F29;&#x5199;&#x3002;&#x5305;&#x542B;&#xFF1A;&#x539F;&#x5B50;&#x6027;&#xFF08;Atomicity&#xFF09;&#x3001;&#x4E00;&#x81F4;&#x6027;&#xFF08;Consistency&#xFF09;&#x3001;&#x9694;&#x79BB;&#x6027;&#xFF08;Isolation&#xFF09;&#x3001;&#x6301;&#x4E45;&#x6027;&#xFF08;Durability&#xFF09;&#x3002;&#x4E00;&#x4E2A;&#x652F;&#x6301;&#x4E8B;&#x52A1;&#xFF08;Transaction&#xFF09;&#x7684;&#x6570;&#x636E;&#x5E93;&#xFF0C;&#x5FC5;&#x987B;&#x8981;&#x5177;&#x6709;&#x8FD9;&#x56DB;&#x79CD;&#x7279;&#x6027;&#xFF0C;&#x5426;&#x5219;&#x5728;&#x4E8B;&#x52A1;&#x8FC7;&#x7A0B;&#xFF08;Transaction processing&#xFF09;&#x5F53;&#x4E2D;&#x65E0;&#x6CD5;&#x4FDD;&#x8BC1;&#x6570;&#x636E;&#x7684;&#x6B63;&#x786E;&#x6027;&#xFF0C;&#x4EA4;&#x6613;&#x8FC7;&#x7A0B;&#x6781;&#x53EF;&#x80FD;&#x8FBE;&#x4E0D;&#x5230;&#x4EA4;&#x6613;&#x65B9;&#x7684;&#x8981;&#x6C42;&#x3002;</p>
<p>&#x6392;&#x4ED6;&#x9501;&#xFF0C;&#x53C8;&#x79F0;&#x4E3A;&#x5199;&#x9501;&#x3001;&#x72EC;&#x5360;&#x9501;&#xFF0C;&#x662F;&#x4E00;&#x79CD;&#x57FA;&#x672C;&#x7684;&#x9501;&#x7C7B;&#x578B;&#x3002;</p>
<h2 id="&#x4E09;&#x4E8B;&#x52A1;&#x5904;&#x7406;&#x5E38;&#x89C1;&#x95EE;&#x9898;">&#x4E09;:&#x4E8B;&#x52A1;&#x5904;&#x7406;&#x5E38;&#x89C1;&#x95EE;&#x9898;</h2>
<p>&#x4E8B;&#x52A1;&#x5904;&#x7406;-&#x5148;&#x540E;&#x987A;&#x5E8F;
&#x4E00;&#x4E2A;&#x8BFB;&#x8BF7;&#x6C42;&#x5E94;&#x8BE5;&#x8BFB;&#x54EA;&#x4E00;&#x4E2A;&#x5199;&#x4E4B;&#x540E;&#x7684;&#x6570;&#x636E;?
&#x903B;&#x8F91;&#x65F6;&#x95F4;&#x6233; : &#x4FDD;&#x8BC1;&#x4E8B;&#x52A1;&#x5355;&#x5143;&#x5148;&#x540E;
scn(oracle)
trx_id(Innodb)
Etc...</p>
<p>&#x4E8B;&#x52A1;&#x5904;&#x7406;-&#x6545;&#x969C;&#x6062;&#x590D;
&#x53EF;&#x80FD;&#x7684;&#x9519;&#x8BEF;&#x60C5;&#x51B5;,&#x4E1A;&#x52A1;&#x5C5E;&#x6027;&#x4E0D;&#x5339;&#x914D;,&#x4FDD;&#x8BC1;&#x539F;&#x5B50;&#x6027;,&#x56DE;&#x6EDA;
&#x7CFB;&#x7EDF;&#x5D29;&#x6E83;: &#x4E8B;&#x52A1;&#x5355;&#x5143;&#x4E2D;&#x95F4;&#x72B6;&#x6001;&#x7A81;&#x7136;&#x5D29;&#x6E83;&#x540E;&#x91CD;&#x542F;&#x8981;&#x56DE;&#x6EDA;,&#x4E0D;&#x80FD;&#x88AB;&#x5176;&#x4ED6;&#x5E94;&#x7528;&#x4F7F;&#x7528;,&#x6240;&#x4EE5;&#x6570;&#x636E;&#x5E93;&#x6709;&#x4E00;&#x4E2A;&#x6062;&#x590D;&#x72B6;&#x6001;</p>
<p>&#x4E8B;&#x52A1;&#x5904;&#x7406;-&#x6B7B;&#x9501;&#x4E0E;&#x6B7B;&#x9501;&#x68C0;&#x6D4B;
&#x6B7B;&#x9501;&#x4EA7;&#x751F;&#x7684;&#x539F;&#x56E0;: 
&#x4E24;&#x4E2A;&#x7EBF;&#x7A0B;
&#x4E0D;&#x540C;&#x65B9;&#x5411;
&#x76F8;&#x540C;&#x8D44;&#x6E90;</p>
<p>&#x6B7B;&#x9501;&#x7684;&#x89E3;&#x51B3;&#x65B9;&#x6848;
&#x5C3D;&#x53EF;&#x80FD;&#x4E0D;&#x6B7B;&#x9501;
&#x78B0;&#x649E;&#x68C0;&#x6D4B;  --- &#x4E3B;&#x6D41;&#x6570;&#x636E;&#x5E93;&#x4F7F;&#x7528;
&#x7B49;&#x9501;&#x8D85;&#x65F6;  -- &#x8F85;&#x52A9;&#x4E8B;&#x52A1;</p>
<p>&#x4ECE;&#x5355;&#x673A;&#x4E8B;&#x52A1;&#x5230;&#x5206;&#x5E03;&#x5F0F;&#x4E8B;&#x52A1;
&#x5206;&#x5E03;&#x5F0F;&#x4E8B;&#x52A1;&#x4E0E;&#x5355;&#x673A;&#x4E8B;&#x52A1;,&#x76F8;&#x540C;&#x4E0E;&#x4E0D;&#x540C;
&#x5206;&#x5E03;&#x5F0F;&#x4E8B;&#x52A1;&#x7684;&#x4E3B;&#x8981;&#x96BE;&#x9898;
&#x4F20;&#x7EDF;&#x6570;&#x636E;&#x5E93;&#x7684;&#x5206;&#x5E03;&#x5F0F;&#x4E8B;&#x52A1;
&#x65B0;&#x5174;&#x4E92;&#x8054;&#x7F51;&#x884C;&#x4E1A;&#x7684;&#x5206;&#x5E03;&#x5F0F;&#x4E8B;&#x52A1;&#x5C1D;&#x8BD5;
  Google Spanner&#x8D4F;&#x6790;
  &#x963F;&#x91CC;&#x7684;&#x5206;&#x5E03;&#x5F0F;&#x4E8B;&#x52A1;&#x6A21;&#x578B;
  DRDS/TDDL&#x5B9E;&#x8DF5;</p>
<p>&#x4E8B;&#x52A1;&#x7684;ACID
&#x4E00;&#x81F4;&#x6027; can(happen before)
&#x9694;&#x79BB;&#x6027; &#x4EE5;&#x6027;&#x80FD;&#x4E3A;&#x7406;&#x7531;,&#x5BF9;&#x4E00;&#x81F4;&#x6027;&#x7684;&#x7834;&#x574F;
&#x8BFB;&#x5199;&#x9501; 
&#x8BFB;&#x5DF2;&#x63D0;&#x4EA4; read committed
  &#x8BFB;&#x8BFB;&#x5E76;&#x884C;, &#x8BFB;&#x5199;&#x5E76;&#x884C;(&#x5199;&#x8BFB;&#x8FD8;&#x4E0D;&#x80FD;)
&#x8BFB;&#x672A;&#x63D0;&#x4EA4; 
  &#x53EA;&#x52A0;&#x5199;&#x9501;,&#x8BFB;&#x4E0D;&#x52A0;&#x9501;</p>
<p>&#x9694;&#x79BB;&#x6027;&#x5C0F;&#x7ED3;
SQL92&#x6807;&#x51C6;&#x5B9A;&#x4E49;&#x7684;&#x9694;&#x79BB;&#x6027;
&#x5E8F;&#x5217;&#x5316; 
&#x53EF;&#x91CD;&#x590D;&#x8BFB;
&#x8BFB;&#x5DF2;&#x63D0;&#x4EA4;
&#x8BFB;&#x672A;&#x63D0;&#x4EA4;   </p>
<p>&#x65B0;&#x7684; &#x5FEB;&#x7167;&#x9694;&#x79BB;&#x7EA7;&#x522B;
Multi-Version Concurrency Control &#x591A;&#x7248;&#x672C;&#x5E76;&#x53D1;&#x63A7;&#x5236;&#xFF0C;MVCC 
&#x65B0;&#x7684;&#x65B9;&#x5F0F; MVCC &#x591A;&#x7248;&#x672C;&#x63A7;&#x5236; &#x8BFB;&#x8BFB;&#x5E76;&#x884C;,&#x8BFB;&#x5199;&#x5E76;&#x884C;,&#x5199;&#x8BFB;&#x5E76;&#x884C;</p>
<p>&#x52A0;&#x9501;&#x540E;&#x7684;&#x8BFB;&#x672A;&#x63D0;&#x4EA4;&#x53EF;&#x80FD;&#x8BFB;&#x5230;&#x4E2D;&#x95F4;&#x72B6;&#x6001;&#x7684;&#x6570;&#x636E;,&#x4E1A;&#x52A1;&#x4E0D;&#x5141;&#x8BB8;
&#x4F46;&#x662F;&#x4F7F;&#x7528;&#x5FEB;&#x7167;&#x8BFB;&#x7684;&#x60C5;&#x51B5;&#x4E0B;&#x80FD;&#x4FDD;&#x8BC1;&#x5728;&#x4E00;&#x81F4;&#x6027;&#x7684;&#x540C;&#x65F6;&#x5B9E;&#x73B0;&#x8BFB;&#x672A;&#x63D0;&#x4EA4;</p>
<p>SQL92&#x6807;&#x51C6; &#x6EDE;&#x540E;&#x4E8E; &#x4EBA;&#x7684;&#x5B9E;&#x73B0;
&#x6807;&#x51C6; &#x4E0D;&#x7B49;&#x4E8E;  &#x5BF9;  ACID&#x4E0D;&#x4E00;&#x5B9A;&#x5BF9;</p>
<p>&#x4E1A;&#x52A1;&#x5E94;&#x7528;&#x7684;&#x53D1;&#x5C55;&#x5DF2;&#x7ECF;&#x8FDC;&#x8FDC;&#x8D85;&#x8FC7;&#x5BF9;&#x4F20;&#x7EDF;&#x610F;&#x4E49;&#x4E0A;&#x4E8B;&#x52A1;&#x7684;&#x8BA4;&#x8BC6;</p>
<p>&#x5199; &#x548C;  &#x5199;   &#x6709;&#x6CA1;&#x6709;&#x53EF;&#x80FD;&#x5E76;&#x884C;?</p>
<p>&#x5FEB;&#x7167;(snapshot isolation)</p>
<ul>
<li>&#x9488;&#x5BF9;&#x8BFB;&#x591A;&#x5199;&#x5C11;&#x573A;&#x666F;&#x4F18;&#x5316;</li>
<li>&#x5E76;&#x884C;&#x5EA6;&#x80FD;&#x5230;&#x8FBE;&#x6216;&#x8D85;&#x8FC7;&#x5EA6;&#x4F4D;&#x63D0;&#x4EA4;,&#x800C;&#x9694;&#x79BB;&#x7EA7;&#x522B;&#x5F88;&#x9AD8;</li>
</ul>
<p>&#x6301;&#x4E45;&#x6027; 
&#x4E8B;&#x52A1;&#x5B8C;&#x6210;&#x4EE5;&#x540E;,&#x8BE5;&#x4E8B;&#x52A1;&#x5BF9;&#x6570;&#x636E;&#x5E93;&#x6240;&#x4F5C;&#x7684;&#x66F4;&#x6539;&#x4FBF;&#x6301;&#x4E45;&#x7684;&#x4FDD;&#x5B58;&#x5728;&#x6570;&#x636E;&#x5E93;&#x4E2D;
BUT  &#x5982;&#x4F55;&#x624D;&#x80FD;&#x786E;&#x4FDD;&#x6570;&#x636E;&#x4E0D;&#x4E22;&#x5462;?</p>
<p>RAID &#x7684;&#x6301;&#x4E45;&#x6027;
1.&#x78C1;&#x76D8;&#x7684;&#x7269;&#x7406;&#x635F;&#x574F;
2.&#x6BCF;&#x4E00;&#x6B21;commit&#x90FD;&#x8981;fsync&#x5230;&#x78C1;&#x76D8;,&#x6027;&#x80FD;&#x4E0B;&#x964D;
&#x6301;&#x4E45;&#x6027;&#x548C;&#x5EF6;&#x8FDF; &#x4E24;&#x4E2A;&#x5BF9;&#x7ACB;</p>
<p>1.&#x63D0;&#x4EA4;&#x8BF7;&#x6C42;&#x5230;&#x5185;&#x5B58;&#x540E;&#x8FD4;&#x56DE;,&#x4E00;&#x6279;&#x63D0;&#x4EA4;&#x5728;&#x5237;&#x5230;&#x78C1;&#x76D8;,&#x505A;&#x5230;&#x5757;&#x5B58;&#x50A8;
2.&#x5C06;&#x5185;&#x5B58;&#x7684;&#x6570;&#x636E;&#x6253;&#x5305;&#x5230;&#x78C1;&#x76D8;</p>
<h2 id="&#x6838;&#x5FC3;&#x76EE;&#x7684;-&#x63D0;&#x793A;&#x5E76;&#x884C;&#x5EA6;">&#x6838;&#x5FC3;&#x76EE;&#x7684;: &#x63D0;&#x793A;&#x5E76;&#x884C;&#x5EA6;</h2>
<p>&#x5355;&#x673A;&#x4E8B;&#x52A1;&#x7684;&#x5178;&#x578B;&#x5F02;&#x5E38;&#x5E94;&#x5BF9;&#x7B56;&#x7565;
&#x4E1A;&#x52A1;&#x5C5E;&#x6027;&#x4E0D;&#x5339;&#x914D;</p>
<ul>
<li>&#x539F;&#x5B50;&#x6027;</li>
<li>&#x4E00;&#x81F4;&#x6027; </li>
<li>&#x56DE;&#x6EDA;</li>
</ul>
<h2 id="&#x7CFB;&#x7EDF;down&#x7EA7;">&#x7CFB;&#x7EDF;DOWN&#x7EA7;</h2>
<p>&#x91CD;&#x542F;&#x540E;&#x8FDB;&#x5165;recovery&#x6A21;&#x5F0F;
 &#x63D0;&#x4EA4;&#x540E;&#x4E8B;&#x52A1;&#x5355;&#x5143;&#x7EE7;&#x7EED;&#x5B8C;&#x6210;&#x63D0;&#x4EA4;
 &#x4E3A;&#x63D0;&#x4EA4;&#x4E8B;&#x52A1;&#x5355;&#x5143;&#x56DE;&#x6EDA;
recovery &#x8FDB;&#x7A0B;&#x6302;&#x6389;,&#x91CD;&#x542F;recovery
&#x8BB0;&#x5F55;&#x65E5;&#x5FD7;,&#x4FDD;&#x8BC1;&#x4E0D;&#x4F1A;&#x51FA;&#x73B0;&#x6570;&#x636E;&#x4E22;&#x5931;....</p>
<h2 id="&#x4E8B;&#x52A1;&#x7684;&#x8C03;&#x4F18;&#x539F;&#x5219;">&#x4E8B;&#x52A1;&#x7684;&#x8C03;&#x4F18;&#x539F;&#x5219;</h2>
<p>&#x4E8B;&#x52A1;&#x7684;&#x8C03;&#x4F18;&#x7684;&#x601D;&#x8DEF;&#x662F;&#x5728;&#x4E0D;&#x5F71;&#x54CD;&#x4E1A;&#x52A1;&#x5E94;&#x7528;&#x7684;&#x524D;&#x63D0;&#x4E0B;&#xFF1A;
&#x7B2C;&#x4E00;&#xFF0C;&#x5C3D;&#x53EF;&#x80FD;&#x51CF;&#x5C11;&#x9501;&#x7684;&#x8986;&#x76D6;&#x8303;&#x56F4;&#xFF0C;&#x4F8B;&#x5982;Myisam&#x8868;&#x9501;&#x5230;Innodb&#x7684;&#x884C;&#x9501;&#x5C31;&#x662F;&#x4E00;&#x4E2A;&#x51CF;&#x5C11;&#x9501;&#x8986;&#x76D6;&#x8303;&#x56F4;&#x7684;&#x8FC7;&#x7A0B;&#xFF1B;&#x5BF9;&#x4E8E;&#x539F;&#x4F4D;&#x9501;&#xFF08;&#x6392;&#x4ED6;&#x9501;&#x3001;&#x8BFB;&#x5199;&#x9501;&#x7B49;&#xFF09;&#x53EF;&#x53D8;&#x4E3A;MVCC&#x591A;&#x7248;&#x672C;&#xFF08;&#x672C;&#x8D28;&#x4ECD;&#x7136;&#x662F;&#x51CF;&#x5C11;&#x9501;&#x7684;&#x8303;&#x56F4;&#xFF09;&#x3002;
&#x7B2C;&#x4E8C;&#xFF0C;&#x589E;&#x52A0;&#x9501;&#x4E0A;&#x53EF;&#x5E76;&#x884C;&#x7684;&#x7EBF;&#x7A0B;&#x6570;&#xFF0C;&#x4F8B;&#x5982;&#x8BFB;&#x9501;&#x548C;&#x5199;&#x9501;&#x7684;&#x5206;&#x79BB;&#xFF0C;&#x5141;&#x8BB8;&#x5E76;&#x884C;&#x8BFB;&#x53D6;&#x6570;&#x636E;&#x3002;
&#x7B2C;&#x4E09;&#xFF0C;&#x9009;&#x62E9;&#x6B63;&#x786E;&#x9501;&#x7C7B;&#x578B;&#xFF0C;&#x5176;&#x4E2D;&#x60B2;&#x89C2;&#x9501;&#x9002;&#x5408;&#x5E76;&#x53D1;&#x4E89;&#x62A2;&#x6BD4;&#x8F83;&#x4E25;&#x91CD;&#x7684;&#x573A;&#x666F;&#xFF1B;&#x4E50;&#x89C2;&#x9501;&#x9002;&#x5408;&#x5E76;&#x53D1;&#x4E89;&#x62A2;&#x4E0D;&#x592A;&#x4E25;&#x91CD;&#x7684;&#x573A;&#x666F;&#x3002;</p>
<p>&#x60B2;&#x89C2;&#x9501;: &#x4F7F;&#x5F97;&#x7EBF;&#x7A0B;&#x5230;blocking&#x72B6;&#x6001;,&#x901A;&#x77E5;&#x4FE1;&#x606F;OK&#x7684;&#x72B6;&#x6001;&#x5207;&#x6362;&#x56DE;&#x7B49;&#x5F85;&#x72B6;&#x6001;, &#x5BC4;&#x5B58;&#x5668;CPU&#x4E0A;&#x4E0B;&#x6587;&#x6362;&#x5165;&#x6362;&#x51FA;, &#x53C8;&#x53EF;&#x80FD;&#x6027;&#x80FD;&#x964D;&#x4F4E;,
&#x4E50;&#x89C2;&#x9501;: </p>
<h2 id="&#x5355;&#x673A;&#x4E8B;&#x52A1;&#x62FE;&#x9057;">&#x5355;&#x673A;&#x4E8B;&#x52A1;&#x62FE;&#x9057;</h2>
<p>1.&#x4E8B;&#x52A1;&#x5355;&#x5143;&#x6269;&#x5C55;</p>
<p>2.&#x6B7B;&#x9501;&#x6269;&#x5C55; - U&#x9501;</p>
<p>3.MVCC&#x62FE;&#x9057;</p>
<p>&#x5206;&#x5E03;&#x5F0F;&#x4E8B;&#x52A1;&#x9762;&#x4E34;&#x7684;&#x95EE;&#x9898;</p>
<p>google spanner&#x7684;&#x521B;&#x65B0;&#x4E0E;&#x4EE3;&#x4EF7;</p>
<p>DRDS/TDDL&#x7684;&#x5B9E;&#x8DF5;</p>
<h2 id="&#x53C2;&#x8003;">&#x53C2;&#x8003;</h2>
<p>&#x6155;&#x8BFE;&#x7F51;&#x6C88;&#x8BE2;&#x4E8B;&#x52A1;&#x89C6;&#x9891;
<a href="https://www.imooc.com/video/9493" target="_blank">https://www.imooc.com/video/9493</a>
&#x6C88;&#x8BE2;&#x963F;&#x91CC;&#x535A;&#x5BA2;
<a href="http://jm.taobao.org/2017/02/09/20170209/" target="_blank">http://jm.taobao.org/2017/02/09/20170209/</a></p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="2020-01-12-缓存穿透-缓存击穿-缓存雪崩概念及解决方案.html" class="navigation navigation-prev " aria-label="Previous page: 9.2020-01-12-缓存穿透-缓存击穿-缓存雪崩概念及解决方案">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="2020-01-13-幂等性.html" class="navigation navigation-next " aria-label="Next page: 11.2020-01-13-幂等性">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"layout":"post","title":"10.2020-01-13-事务笔记","categories":["java","SQL","事务"],"description":"事务","keywords":"java,SQL,事务","level":"2.6.10","depth":2,"next":{"title":"11.2020-01-13-幂等性","level":"2.6.11","depth":2,"path":"java/2020-01-13-幂等性.md","ref":"java/2020-01-13-幂等性.md","articles":[]},"previous":{"title":"9.2020-01-12-缓存穿透-缓存击穿-缓存雪崩概念及解决方案","level":"2.6.9","depth":2,"path":"java/2020-01-12-缓存穿透-缓存击穿-缓存雪崩概念及解决方案.md","ref":"java/2020-01-12-缓存穿透-缓存击穿-缓存雪崩概念及解决方案.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"java/2020-01-13-事务笔记.md","mtime":"2020-01-16T07:57:20.028Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-08-27T08:51:05.639Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

